import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;


public class server {
	public static void main(String[] args) throws IOException {
		ServerSocket ss = new ServerSocket(2358);
		String input = "";
		String total = "";
		while(true){
			Socket client = ss.accept();
			
			BufferedReader br = new BufferedReader(new InputStreamReader(client.getInputStream()));
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
			
			while(input != null && (!input.equals("END"))){
				total += input + "\n";
				input = br.readLine();
			}
			bw.write(total);
			bw.flush();
			bw.close();
		}
	}

}
